import { useSearchParams, useParams } from "react-router-dom";

export default function Article() {
  // searchParams传参
  //   const [params] = useSearchParams();
  //   const name = params.get("name");
  //   const age = params.get("age");

  /**
   * params传参
   * 需要配合路由使用
   */
  const params = useParams();
  const name = params.name;
  const age = params.age;
  return (
    <>
      <div>
        我是文章页
        <div>姓名：{name}</div>
        <div>年龄：{age}</div>
      </div>
    </>
  );
}
